﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XZL.GM.Dal;
using XZL.GM.Entity;

namespace XZL.GM.Bll
{
   public class TeacherInfoBiz
    {

        /// <summary>
        /// 获取讲师列表
        /// </summary>
        /// <param name="TeacherName"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="pageCount"></param>
        /// <returns></returns>
        /// 

       public static List<Proc_TeacherInfo_SelectListResult> GetTeacherList(string teacherName, int pageIndex, int pageSize, ref int? pageCount)
        {
          XZL_GMDataContext db = new XZL_GMDataContext();
          return db.Proc_TeacherInfo_SelectList(teacherName, pageIndex, pageSize, ref pageCount).ToList();
        }

       /// <summary>
       /// 获取讲师信息
       /// </summary>
       /// <param name="TeacherID"></param>
       /// <returns></returns>
       public static Proc_Teacher_SelectInfoResult GetTeacherInfo(int teacherID)
       {
           XZL_GMDataContext db = new XZL_GMDataContext();
           return db.Proc_Teacher_SelectInfo(teacherID).FirstOrDefault();
       }

        /// <summary>
        /// 添加讲师
        /// </summary>
       /// <param name="TeacherID">用户ID</param>
        /// <returns>0：成功  -1：用户名存在    -3：数据库错误</returns>

       public static bool TeacherAddition(Teacher teacher)
       {
           XZL_GMDataContext db = new XZL_GMDataContext();

           int i = db.Proc_TeacherInfo_Addition(teacher.TeacherName, teacher.TeacherImg,teacher.TeacherTitle1,teacher.TeacherTitle2,teacher.TeacherInfo);

           return true;
       }



        /// <summary>
        /// 编辑讲师
        /// </summary>
        /// <param name="TeacherID">用户ID</param>
        /// <returns>    </returns>
       public static bool TeacherUpdate(Teacher teacher)
       {
           XZL_GMDataContext db = new XZL_GMDataContext();

           int i = db.Proc_TeacherInfo_Update(teacher.TeacherID, teacher.TeacherName, teacher.TeacherImg, teacher.TeacherTitle1, teacher.TeacherTitle2,teacher.TeacherInfo, teacher.Status);

           return true;
       }


    }
}
